package com.huiyeji.hui.config;

import com.aliyun.oss.OSSClient;
import com.huiyeji.hui.properties.AliyunOssProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author zhaoduo
 */
@Configuration
@EnableConfigurationProperties(AliyunOssProperties.class)
public class OssConfig {

    @Bean
    public OSSClient ossClient(AliyunOssProperties aliyunOssProperties){
        return new OSSClient(aliyunOssProperties.getEndpoint(),
                                            aliyunOssProperties.getAccessKeyId(),
                                            aliyunOssProperties.getAccessKeySecret());
    }
}
